import request from '@/utils/request'

//已发布表单
export function getPageRelease(params) {
    return request({
        url: '/form/sys/pageRelease',
        method: 'get',
        params: params
    })
}

//插入数据
export function insertdata(obj) {
    return request({
        url: '/form/project/insertdata',
        method: 'post',
        data: obj
    })
}

//修改数据
export function updata(obj) {
    return request({
        url: '/form/project/updata',
        method: 'post',
        data: obj
    })
}

//获取单独数据
export function getDataOneId(params) {
    return request({
        url: '/form/project/getDataOneId',
        method: 'get',
        params: params
    })
}

//删除(批量删除)数据
export function deletedata(idList) {
    return request({
        url: '/form/project/deletedata',
        method: 'delete',
        params: idList
    })
}

//删除管理界面全部数据
export function deletedataAll(params) {
  return request({
      url: '/form/project/deletedataAll',
      method: 'delete',
      params: params
  })
}
//查询列表数据
export function getListData(params) {
    return request({
        url: '/form/project/data-page',
        method: 'get',
        params: params
    })
}

//修改表单信息
export function editFormInfo(form) {
    return request({
        url: '/form/sys/publish',
        method: 'post',
        data: form
    })
}

//菜单发布
export function menuRelease(obj) {
    return request({
        url: '/system/menu/createpub',
        method: 'post',
        data: obj
    })
}

// 创建按钮
export function createBtn(obj) {
    return request({
        url: '/system/menu/createpubbatch',
        method: 'post',
        data: obj
    })
}

// 删除按钮
export function deleteBtn(obj) {
    return request({
        url: '/system/menu/deleteBath',
        method: 'delete',
        params: obj
    })
}

//修改菜单
export function menuUpdate(obj) {
    return request({
        url: '/system/menu/update',
        method: 'put',
        data: obj
    })
}

//分页获取未发布表单（下拉框）
export function getPageNoRelease(params) {
    return request({
        url: '/form/sys/pageNoRelease',
        method: 'get',
        params: params
    })
}

//表单发布页面删除按钮
export function delFormInfo(id) {
    return request({
        url: `/form/sys/noRelease/${id}`,
        method: 'get'
    })
}

//表单发布页面批量删除
export function multiDel(ids) {
    return request({
        url: `/form/sys/noReleaseBatch`,
        method: 'post',
        data: ids
    })
}
//获取表单表详情
export function getFormJsonData(id) {
    return request({
        url: `/form/sys/${id}`,
        method: 'get'
    })
}

//获取所有菜单
export function getAllMenu() {
    return request({
        url: `/system/menu/listforform`,
        method: 'get'
    })
}

//表单关联流程
export function getProcessIn(formId) {
    return request({
        url: `/bpm/process-instance/${formId}`,
        method: 'get'
    })
}

// 删除实列
export function deleteExampleData(idList) {
    return request({
        url: '/bpm/process-instance/delete',
        method: 'delete',
        data: idList
    })
}


//导出(批量导出)数据
export function getIdsData(params) {
  return request({
      url: '/form/project/getIdsData',
      method: 'get',
      params: params
  })
}

//获取所有数据
export function getAllListData(params) {
    return request({
        url: `/form/project/getAllListData`,
        method: 'get',
        params: params
    })
}

// 导出全部详情
export function getDataOut(params) {
  return request({
    url: `/form/project/getDataOut`,
    method: 'get',
    params: params,
    responseType: 'blob', // 指明返回格式
    header: {
      headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }
    }
  })
}

//下载(批量下载)数据
export function getVesDataPoc(params) {
  return request({
      url: '/form/project/vesDataPoc',
      method: 'get',
      responseType:'blob',
      params: params
  })
}

//下载所有数据
export function getVesDataPocAll(params) {
  return request({
    url: `/form/project/vesDataPocAll`,
    method: 'get',
    responseType:'blob',
    params: params
  })
}

//判断全部下载是否有附件
export function isNullFile(params) {
  return request({
    url: `/form/project/isNullFile`,
    method: 'get',
    params: params
  })
}

//面板获取计算值
export function getFormulaValue(params) {
    return request({
        url: `/form/project/getColumnFormula`,
        method: 'post',
        data: params
    })
}

//批量插入数据
export function insertdatalist(params) {
    return request({
        url: `/form/project/insertdatalist`,
        method: 'post',
        data: params
    })
}
//删除菜单
export function deletepub(id){
    return request({
        url:'system/menu/deletepub?id=' + id,
        method:'delete',
    })
}

// 查询子表单数据
export function getChildListData(params) {
    return request({
        url: `/form/project/getChildListData`,
        method: 'post',
        data: params
    })
}

//批量更新数据
export function updatedatalist(params) {
    return request({
        url: `/form/project/updatedatalist`,
        method: 'post',
        data: params
    })
}

//联动数据接口
export function getLinkData(params) {
    return request({
        url: `/form/project/getLinkData`,
        method: 'post',
        data: params
    })
}

// 关联关系接口
export function getRelationData(params) {
    return request({
        url: `/form/project/getRelationData`,
        method: 'post',
        data: params
    })
}

// 新增版本记录
export function addCurVersion(params) {
    return request({
        url: `/bpm/process-instance/create`,
        method: 'post',
        data: params
    })
}

//获取当前版本
export function getCurVersion(params) {
    return request({
        url: `/form/project/getVesion`,
        method: 'get',
        params: params
    })
}

//插入数据
export function insertdataall(obj) {
    return request({
        url: '/form/project/insertdataall',
        method: 'post',
        data: obj
    })
}

//变更 修改 all
export function updataall(obj) {
    return request({
        url: '/form/project/updataall',
        method: 'post',
        data: obj
    })
}
//批量发起审批
export function batchCreate(params) {
    return request({
        url: `/bpm/process-instance/batchCreate`,
        method: 'post',
        data: params
    })
}
// 获取所有列表
export function getListAllData(id) {
    return request({
      url: '/form/project/getAllListData?tableName=' + id,
      method: 'get',
    })
  }
    // 获取所有列表
export function getAllListDataForm(id) {
    return request({
      url: '/form/project/getAllListDataForm?tableName=' + id,
      method: 'get',
    })
  }